Skip to content

refactor(e2e): fast block build config in e2e tests#23340

Draft
spalladino wants to merge 10 commits into
merge-train/spartanfrom
palla/kill-anvil-test-watcher
Draft

refactor(e2e): fast block build config in e2e tests#23340
spalladino wants to merge 10 commits into
merge-train/spartanfrom
palla/kill-anvil-test-watcher

Conversation

@spalladino
Copy link
Copy Markdown
Contributor

@spalladino spalladino commented May 16, 2026

Motivation

AnvilTestWatcher polls every 200ms and silently mutates global state from three different RunningPromises — proving, dateProvider sync, and L1 time warping. The wiring difference between e2e and sandbox makes failures (the gist f3cdad44… two-dateProvider-read race, e2e_pruned_blocks finalized-stuck-at-0, blacklist huge-warp wedges) hard to diagnose. Deleting it from e2e in favor of deterministic per-responsibility replacements gets us:

  • L1 time advances on a known cadence (anvil_setIntervalMining), no surprise warps.
  • Proven tip moves only when a checkpoint actually publishes, gated on archiver indexing.
  • dateProvider mutates only when a cheat code explicitly warps L1, atomically with the RPC.

The AnvilTestWatcher class stays in the tree so sandbox / local-network can keep using it. This PR only changes the e2e fixture wiring.

Approach

Full design in KILL_ANVIL_TEST_WATCHER_PLAN.md. Codex round-2 reviewed and corrections folded in (slot math, stricter auto-prove wait, setNextBlockTimestamp/mine() audit, second-batch deferrals).

What's landed

Foundation

  1. feat(e2e): add FAST_E2E_SETUP_OPTS preset with single-block fast-mode timing — preset + timetable unit test (3.75s block budget, 20s publishing deadline).
  2. feat(testing): add CheckpointAutoProver helper — replaces the watcher's markAsProven loop. Unit tests cover wait pattern + queue + stop.
  3. fix(ethereum): atomically sync TestDateProvider in cheat-code mine/warp pathsmine(), evmMine(), mineEmptyBlock() sync TestDateProvider. Removes redundant manual setTime at three call sites.
  4. refactor(e2e): unconditional anvil interval mining + drop AnvilTestWatcherfixtures/setup.ts integration: drop automineL1Setup, unconditional setIntervalMining, default-skip watcher.start(), wire CheckpointAutoProver. Removes redundant setIsMarkingAsProven(false) from 8 call sites.
  5. test(e2e): add e2e_fast_config smoke test — canary exercising 20 sequential txs in distinct blocks + proven-tip advancement.

Migrations (47 tests total, 4 commits)

  1. test(e2e): migrate first batch of single-sequencer tests — 10 tests.
  2. test(e2e): migrate second batch of single-sequencer tests — 22 tests.
  3. test(e2e): migrate e2e_amm to FAST_E2E_SETUP_OPTS — 1 test (had a third setup arg, missed in batch 2).
  4. test(e2e): thread opts through TokenContractTest + NestedContractTest — 2 base classes threaded with opts?: Partial<SetupOptions>, 14 tests migrated (8 token + 4 nested + 2 base classes).

Held back from this PR

  • e2e_2_pxes — two PXEs behind one sequencer; more sync-sensitive. Migrate in a follow-up after first-batch CI is green.
  • e2e_cheat_codes — exercises setNextBlockTimestamp and mine() directly. Wave-1 cheat-code audit deliberately did NOT add atomic dateProvider sync to setNextBlockTimestamp (it schedules but doesn't mine — sync happens at the subsequent mine). Tests reading dateProvider.now() right after setNextBlockTimestamp would see the old value; needs hand audit.
  • e2e_lending_contract — hand-rolled time helpers in its cc.eth.warp simulator. Needs normalization before migration.
  • BlacklistTokenContractTest (7 suites) — huge time warps wedge the pipelined publisher AND hit B7. Blocked on source fix, not a watcher issue.

Explicitly out of scope (separate PRs)

  • B2 forward-port from sp/publisher-simulation-cleanup.
  • B7 (simulatePublicCalls queries unsealed checkpoint).
  • publisher_manager.ts second-round funder silence.
  • Sequencer invalidateInFlightCheckpointsBefore(slot) for huge-warp scenarios.

Status

Draft. Foundation + smoke test + 47 migrated tests in place. Mark non-draft to trigger e2e CI. Consider ci-no-fail-fast for the first run so we see all failures at once.

@ludamad ludamad force-pushed the merge-train/spartan branch from 4af2626 to db4ec58 Compare May 16, 2026 19:07
…rp paths

mine(), evmMine(), and mineEmptyBlock() now call syncDateProvider() after mining
so TestDateProvider follows L1 time without callers needing to do it manually.
Remove now-redundant dateProvider.setTime() calls from three e2e test sites.
…tcher markAsProven loop

Adds CheckpointAutoProver, an event-driven helper that subscribes to the
sequencer's checkpoint-published event, waits for the local archiver to
promote the checkpoint (verified via getL2Tips + getBlocks), then calls
rollupCheatCodes.markAsProven(checkpointNumber). Replaces the periodic
polling loop in AnvilTestWatcher.
…tcher

Stop starting AnvilTestWatcher in e2e tests. Anvil now runs in interval mining
mode at ethereumSlotDuration after L1 deploy, so warpTimeIfNeeded and
syncDateProviderToL1IfBehind are unnecessary. The markAsProven loop is replaced
by CheckpointAutoProver when testOnlyAutoProveAfterPublish is true (default via
FAST_E2E_SETUP_OPTS).

AnvilTestWatcher class stays in the tree for the sandbox/local-network entrypoint.
The opt-in automineL1Setup option is removed (three callers cleaned up).
Canary for the AnvilTestWatcher-removal work in this PR. Exercises:
- chain advances under interval mining + pipelining
- 20 sequential dependent txs land in distinct blocks
- proven tip advances via CheckpointAutoProver

Uses FAST_E2E_SETUP_OPTS, the new preset added in this PR.
Missed in batch 2 because of its third argument (syncChainTip: 'checkpointed').
@spalladino spalladino force-pushed the palla/kill-anvil-test-watcher branch from 9208a79 to 1e675e8 Compare May 17, 2026 13:36
@spalladino spalladino added ci-no-fail-fast Sets NO_FAIL_FAST in the CI so the run is not aborted on the first failure ci-draft Run CI on draft PRs. labels May 17, 2026
@spalladino spalladino changed the title refactor(e2e): kill AnvilTestWatcher in e2e tests refactor(e2e): fast block build config in e2e tests May 17, 2026
…TUP_OPTS

Both already used PIPELINING_SETUP_OPTS. The plan flagged them as second-batch
out of caution; verified neither has hand-rolled cc.eth.warp/dateProvider.setTime
helpers that would conflict with the wave-1 cheat-code audit.
@spalladino spalladino force-pushed the palla/kill-anvil-test-watcher branch from 1e675e8 to d9922ef Compare May 17, 2026 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-draft Run CI on draft PRs. ci-no-fail-fast Sets NO_FAIL_FAST in the CI so the run is not aborted on the first failure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant